<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;

class CourseModel extends BaseModel
{
    use HasFactory;
    use SoftDeletes;
    protected $table = 'course';

    protected $fillable = [
        'company_id',
        'type_id',
        'name',
        'time_len',
        'img',
        'status',
        'desc',
        'commission_type',
        'commission_fixed',
        'commission_num_base_price',
        'commission_num_base_num',
        'commission_num_per',
        'commission_stage'
    ];

    public function packages() {
        return $this->hasMany(CoursePackageModel::class, 'course_id');
    }

    public function type() {
        return $this->belongsTo(CourseTypeModel::class, 'type_id');
    }
}
